<?php 

require("../include/config.php");
require("../API/php/fonctions.php");
require("../API/php/header.php");

// phpsql/mysql_mountDurees.php?milis=123456789&crtl=ok

// IN obligatoire
$arrayGet = array(
    "crtl" => null
);

$arrayValeur = recupGet($arrayGet, $bolDecode);

if($arrayValeur["error"] == null){
	// CONNECION SQL
	$db = mysql_connect($host, $base, $mdp)  or die('Erreur de connexion '.mysql_error());

	// CONNECION BASE
	mysql_select_db($base,$db)  or die('Erreur de selection '.mysql_error()); 

	$sql = "TRUNCATE TABLE `vm_inventaire_tocs_vsr`;";
	mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error()); 	

	$sql = "INSERT INTO `vm_inventaire_tocs_vsr`
	SELECT null, b.`id_toc`, b.`liaisons`, a.`id_vsr`
	FROM `tab_inventaire_vsr` a, `vm_inventaire_tocs` b
	WHERE 1=1
	AND b.`liaisons` like CONCAT('%',a.`id_vsr`,'%')
	;";
	mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error()); 

	// DECONNECION SQL
	mysql_close();
}

?>